package com.korilweb.demo_mybatis.service;

import com.korilweb.demo_mybatis.dao.UserMapper;
import com.korilweb.demo_mybatis.entity.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserService {

    @Autowired
    private UserMapper userMapper;

    public User findUserById(int id) {
        return userMapper.selectUserById(id);
    }

    public List<User> findAllUsers() {
        return userMapper.selectAllUsers();
    }

    public int addUser(User user) {
        return userMapper.insertUser(user);
    }

    public int changeUserInfo(User user) {
        return userMapper.updateUserInfo(user);
    }

    public int deleteUserById(int id) {
        return userMapper.deleteUserById(id);
    }
}